Skip to content

I refactored the Boids collection manager to an ES6 class.#2

Open
anoopelias wants to merge 1 commit intomainfrom
feature/boids-collection-class
Open

I refactored the Boids collection manager to an ES6 class.#2
anoopelias wants to merge 1 commit intomainfrom
feature/boids-collection-class

Conversation

@anoopelias
Copy link
Copy Markdown
Owner

I converted the Boids (collection manager) constructor function and its prototype methods in js/index.js into an ES6 class structure.

  • The isInFrontOf helper function was converted to a private instance method #isInFrontOf.
  • Usages of Boids() in js/browser-benchmark.js and js/demo.js were updated to new Boids() for ES6 class compatibility.
  • I updated the unit tests in test/indexTest.js:
    • The relevant test suite was renamed from "Boid" to "Boids Collection".
    • Existing tests were confirmed compatible.
    • New tests were added for findNeighbors, calcCohesion, calcSeparation, calcAlignment, and the tick method, including checks for the logic involving the new private method #isInFrontOf.

I converted the Boids (collection manager) constructor function and its prototype methods in `js/index.js` into an ES6 class structure.

- The `isInFrontOf` helper function was converted to a private instance method `#isInFrontOf`.
- Usages of `Boids()` in `js/browser-benchmark.js` and `js/demo.js` were updated to `new Boids()` for ES6 class compatibility.
- I updated the unit tests in `test/indexTest.js`:
    - The relevant test suite was renamed from "Boid" to "Boids Collection".
    - Existing tests were confirmed compatible.
    - New tests were added for `findNeighbors`, `calcCohesion`, `calcSeparation`, `calcAlignment`, and the `tick` method, including checks for the logic involving the new private method `#isInFrontOf`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant